package svc

import (
	"github.com/zeromicro/go-zero/core/stores/postgres"
	"go-zero-demo-3/mall/user/api/internal/config"
	"go-zero-demo-3/mall/user/api/studentmodel"
)

type ServiceContext struct {
	Config       config.Config
	StudentModel studentmodel.StudentModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := postgres.New(c.DB.DataSource)
	return &ServiceContext{
		Config:       c,
		StudentModel: studentmodel.NewStudentModel(conn, c.Cache),
	}
}
